package asteroids.model.statements;

import asteroids.model.Ship;
import asteroids.model.expressions.*;
import asteroids.model.types.T;

import java.util.*;

/**
 * A class that represents the print statement
 * 
 * @version 1.0
 * 
 * @author	Thijs Peirelinck & Wouter Parys
 *
 */
public class Print extends BasicStatement {
	

	public Print(E e) {
		super(e);
	}
	
	@Override
	public void doStatement(HashMap<String, E> variables) {
		System.out.println(getExpression().toString() + " = " + getValidatedExpressionCopy(getExpression(),variables).getValue().toString());
	}
	
	@Override
	public void setExecuter(Ship executer) {
		getExpression().setExecuter(executer);
	}

	@Override
	public boolean typeCheck(Map<String, T> globals) {
		return getExpression().typeCheck(globals);
	}
}

